<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>选中电影变色</title>
    <link rel="stylesheet" href="./css/Smovie.css">
    <script src="vue.js"></script>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="movie,index in movies" :class="index == select ? 'red' : ''" @click="select=index">{{movie}}</li>
        </ul>
    </div>

    <script>
        var vm = new Vue({
            el:"#app",
            data(){
                return{
                    movies:['教父','阿甘正传','楚门的世界','盗梦空间'],
                    select:0
                }
            }
        })
    </script>
</body>
</html>